<?php

/**
 * MensajeAlerta form base class.
 *
 * @method MensajeAlerta getObject() Returns the current form's model object
 *
 * @package    cronos-doctrine
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseMensajeAlertaForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                => new sfWidgetFormInputHidden(),
      'empresa_id'        => new sfWidgetFormInputText(),
      'padre_id'          => new sfWidgetFormInputText(),
      'mensaje_status_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('MensajeStatus'), 'add_empty' => false)),
      'operador_de_id'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('OperadorDe'), 'add_empty' => false)),
      'operador_para_id'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('OperadorPara'), 'add_empty' => false)),
      'nota'              => new sfWidgetFormTextarea(),
      'created_at'        => new sfWidgetFormDateTime(),
      'updated_at'        => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'empresa_id'        => new sfValidatorInteger(array('required' => false)),
      'padre_id'          => new sfValidatorInteger(array('required' => false)),
      'mensaje_status_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('MensajeStatus'))),
      'operador_de_id'    => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('OperadorDe'))),
      'operador_para_id'  => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('OperadorPara'))),
      'nota'              => new sfValidatorString(),
      'created_at'        => new sfValidatorDateTime(),
      'updated_at'        => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('mensaje_alerta[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'MensajeAlerta';
  }

}
